package myky.com.doctorapp.base;

import io.reactivex.Observer;
import myky.com.doctorapp.api.Exception.ApiException;

public abstract class SimpleSubscribe<T> implements Observer<T> {


    protected abstract void onSuccess(T t);

    protected abstract void onFailed(String msg);


    @Override
    public void onNext(T t) {

        onSuccess(t);

    }

    @Override
    public void onError(Throwable e) {

        ApiException apiException = (ApiException) e;

        onFailed(apiException.getDisplayMessage());

    }

    @Override
    public void onComplete() {

    }
}
